package day02.homework;
//b.编写一个程序，启动三个线程，三个线程的名称分别是 A，B，C；每个线程将自己的名称在屏幕上打印5遍，打印顺序是ABCABC…
public class PrintName {
    public synchronized void print1(){
        String name=Thread.currentThread().getName();
        System.out.print(name);
    }
    public synchronized void print2(){
        String name=Thread.currentThread().getName();
        System.out.print(name);
    }
    public static void print3(){
        String name=Thread.currentThread().getName();
        System.out.print(name);
    }
    public static void main(String[] args) {
        PrintName pn=new PrintName();
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                pn.print1();
            },"A").start();
            new Thread(()->{
                pn.print3();
            },"B").start();
            new Thread(()->{
                pn.print2();
            },"C").start();
        }
    }
}
